UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cU3s1C1gtwyRHi2DZ6LbmAEAECrH4Fd4X623ibWQMZc='
WHERE
key_id = 'a19481954634d8a3fe4dea3e5cdf72dc0bd32b775a17b000158c56e6bf196e28'
AND (
token = 'cU3s1C1gtwyRHi2DZ6LbmAEAECrH4Fd4X623ibWQMZc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)