UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZQCHe3h8BEw7BOBJeiM8dsoq574w1ubJFw+bQl8xrVM='
WHERE
key_id = '4d3d8b036acfc0af169a9b998b57e17d82d7d8f38a2722d0e55c01413ca529d1'
AND (
token = 'ZQCHe3h8BEw7BOBJeiM8dsoq574w1ubJFw+bQl8xrVM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)