UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'teQesI6wnt3k56lfb2+apQ4Nq4FQ98JBLqTcoD6b4Y4=' 
WHERE 
  key_id = '470f7205aac7c0ff8345209b2b6c61eb5a24255f8c2644e9f388105a2b51c207' 
  AND (
    token = 'teQesI6wnt3k56lfb2+apQ4Nq4FQ98JBLqTcoD6b4Y4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032