UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3Z0dN+OkfkkA2R/WePW6r2Ueva2h+iXHL4a23D3dHcs='
WHERE
key_id = 'a7892ff743e1d73afcfac295fa20adbaf694316a002c054f3884d1383b4816ff'
AND (
token = '3Z0dN+OkfkkA2R/WePW6r2Ueva2h+iXHL4a23D3dHcs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)