UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'md/ApqPlCNXUOUK8qpI8Gn1/Mdm8ncT4MRRzkrYG5AQ='
WHERE
key_id = '4165e6dbd0b7c5269b94a30b20281be6c2028ff5773cc83eb424bb014cb737cd'
AND (
token = 'md/ApqPlCNXUOUK8qpI8Gn1/Mdm8ncT4MRRzkrYG5AQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)