UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ND2C7FwWyZWvyVaRIrvtu6lx9J5xuzbF9oAa1IiDBS4=' 
WHERE 
  key_id = '45de19ebdf2ebb031cfd5694a1bfcbc3efdb737704cd7812d4a53c187a247cde' 
  AND (
    token = 'ND2C7FwWyZWvyVaRIrvtu6lx9J5xuzbF9oAa1IiDBS4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023