UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZiG9bDiuntS3dOsjT9fuL3ERSjWD5OaMCjTxuusaoag=' 
WHERE 
  key_id = 'e51b668f724dd12baa938374afb2b669d813e7866d802412ae1051fbda614a98' 
  AND (
    token = 'ZiG9bDiuntS3dOsjT9fuL3ERSjWD5OaMCjTxuusaoag=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039