UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rFhXQrOmBgwhi92jpf5Qny4uWlPis+rPmjMWuLkl8A4='
WHERE
key_id = 'b7fc68abd5b64413788f9771281a607e81f3af187a6700a825d523200ba8e538'
AND (
token = 'rFhXQrOmBgwhi92jpf5Qny4uWlPis+rPmjMWuLkl8A4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)