UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MjBA0ABdC2Coo65KNtJZzKBCeArFmOsifmw+RzKVUHw=' 
WHERE 
  key_id = 'b401e36cc7d9f179ebdcd5b78a588eac46f5283400e8b3bfa15216066e9f4822' 
  AND (
    token = 'MjBA0ABdC2Coo65KNtJZzKBCeArFmOsifmw+RzKVUHw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034