UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MFZWkPHrVVvUL/XXKd/rcg3UmZ08cI2aRvcdH1pHETs=' 
WHERE 
  key_id = 'ef0ab0f842db4a0a2b68e028522e4abf1673f3efa27093d56451cf2bdce7da1d' 
  AND (
    token = 'MFZWkPHrVVvUL/XXKd/rcg3UmZ08cI2aRvcdH1pHETs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034