UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dqN07zHa+jdeDlNkcmcPRtnE/jFIvxoGLofTDEzpdng=' 
WHERE 
  key_id = 'f8392fd2fea0f00d44eaeaf3daaa435e27d0529edc7a0881e633ae87d67161b3' 
  AND (
    token = 'dqN07zHa+jdeDlNkcmcPRtnE/jFIvxoGLofTDEzpdng=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035