UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G47gxxom+PGB+JJvqKOCDM8DBd83n1a8rF7P/NN9pDE=' 
WHERE 
  key_id = '58484ad4b54c0f336010eec663f2ee103dabfd2edc7697935ed4d8ff5beadc49' 
  AND (
    token = 'G47gxxom+PGB+JJvqKOCDM8DBd83n1a8rF7P/NN9pDE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044