UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GbJhdaKy0AxlmV2S4jJmcV871CBt+padWdzVicuvxH0='
WHERE
key_id = 'dd39b741e45fb8bf899e9170025e8b95b5001218d8180243b5fbfb69e3f8aae5'
AND (
token = 'GbJhdaKy0AxlmV2S4jJmcV871CBt+padWdzVicuvxH0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)