UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BjBIqmJsApp4HHOH6eK+zT1Qwo/s54TTvoBecHxaKng='
WHERE
key_id = 'd02f65c694bd36779e0e36ee6b057ffa2955d583b3d8cfaf3db15617bce0436f'
AND (
token = 'BjBIqmJsApp4HHOH6eK+zT1Qwo/s54TTvoBecHxaKng='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)