UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zyFEy1KofpedihN5PRGjTvOeD596qqD0gDOQC3bEBn8=' 
WHERE 
  key_id = '359618e84988317d368c4a7189c82c55c27871e9fe9c1ec5980b0e843c07b64b' 
  AND (
    token = 'zyFEy1KofpedihN5PRGjTvOeD596qqD0gDOQC3bEBn8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029