UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'elaD0ssr68HjIXr7j6MWlvgmQiM6woiRvkKJyyamYhI='
WHERE
key_id = '3a9d2ecde94c52e546d061b6267f45eb181e2a9af66c4c10cd33100e6941ff66'
AND (
token = 'elaD0ssr68HjIXr7j6MWlvgmQiM6woiRvkKJyyamYhI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)