UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sxPotCb87+TiKimXbGAWANvF3UGRnvwxoB3DLvB+KpU=' 
WHERE 
  key_id = '4574d40ed2ef651f4a4041b6baf05fd132b893883a1c465aeca9f2e448d191b3' 
  AND (
    token = 'sxPotCb87+TiKimXbGAWANvF3UGRnvwxoB3DLvB+KpU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031