UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tjPys35hikCbpbBSw9LJyj+mXF+ObOEVM/77iqPaU3c='
WHERE
key_id = '54c99694d2a18cb00a37487ae5d5f5d19977cf2dc3c0c4beb7e5a26c2e0ca4d3'
AND (
token = 'tjPys35hikCbpbBSw9LJyj+mXF+ObOEVM/77iqPaU3c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)