UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'asQ0InHQM+MYMBkVh5BWDKW0ovFOap5FCGjOFyRspZM=' 
WHERE 
  key_id = '4f4ad8facfa67c5be02651a68766b1be51d027793185708e28088742fa3df8a6' 
  AND (
    token = 'asQ0InHQM+MYMBkVh5BWDKW0ovFOap5FCGjOFyRspZM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041