UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C1TXHlNNDoGBaLF+f4lv1BSOi3Nv33y62EpJ6nxGAiA='
WHERE
key_id = '613ee5c527c5d5d9a41d53d893b0035d8c8d973054c03600a36335a250774219'
AND (
token = 'C1TXHlNNDoGBaLF+f4lv1BSOi3Nv33y62EpJ6nxGAiA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)