UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HTATWjt2YSoUjvb/KU4a3BeGdZZjIRjcEHoNwX0r+wE='
WHERE
key_id = 'f09558a1b49e7f07192c28ab87abbe0043c9f1d341b3844babf4501f35b54592'
AND (
token = 'HTATWjt2YSoUjvb/KU4a3BeGdZZjIRjcEHoNwX0r+wE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)