UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'juKYiWPwITsfr9AlJgDdnheMcEIscYHc9mpe3GD3Ikc=' 
WHERE 
  key_id = '8f717e8b0506b249c1e8ca0c53ac9a47f8ff1c4adbb7c048870294a31a09ea83' 
  AND (
    token = 'juKYiWPwITsfr9AlJgDdnheMcEIscYHc9mpe3GD3Ikc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016