UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j1AZfRQl0I9JAY6bJRXs5PNOnlaU+/rtztgAqL+9zmo=' 
WHERE 
  key_id = '9ebcf5380ba281c5360907a20761b91b86a2b07edf1c50244e05bbacff319025' 
  AND (
    token = 'j1AZfRQl0I9JAY6bJRXs5PNOnlaU+/rtztgAqL+9zmo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058