UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yWA9sJifD4EpJZgWgVEwHguiV6JMWBFvYtl1ta0Xrx4='
WHERE
key_id = '7b2613b5c76edada184cebc09fc0cb137a2b00ab3e8a1cf9c3d3b774ac510440'
AND (
token = 'yWA9sJifD4EpJZgWgVEwHguiV6JMWBFvYtl1ta0Xrx4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)