UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'b4hJ3YqASjTsEE8CgRqu2BZ2vsSjQ1tFJkn715UWHB4='
WHERE
key_id = 'c262276c6e3cc485ef0f39050fed9df1ad4a6eb6560dec3fcbd3fabf36c9a814'
AND (
token = 'b4hJ3YqASjTsEE8CgRqu2BZ2vsSjQ1tFJkn715UWHB4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)