UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'odbyd1JxQpClkGP7VtOBk4gUxPnc5vgxLZDFP7LcWeg='
WHERE
key_id = '59150e90f595fda1a1f6281074b201af600f524a50ec59135cceb9be0c18f5ab'
AND (
token = 'odbyd1JxQpClkGP7VtOBk4gUxPnc5vgxLZDFP7LcWeg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)