UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QSQPqINs9Ll/6j+yXgEWQe+H0Rni3ULcoNXllyK33QQ=' 
WHERE 
  key_id = '20a54656aaaf314125e72982dfdb79c85390ecb69f23af1db88189b936b6cdd5' 
  AND (
    token = 'QSQPqINs9Ll/6j+yXgEWQe+H0Rni3ULcoNXllyK33QQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030