UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qLKddrZdw9p5VPbAs2i/WXC7Goa5Mvy9KOpE3ZMwH1Q='
WHERE
key_id = 'b9ffcac9834e6325a0f554c10b1e064330e00a05fd47673f91898bbce27eae32'
AND (
token = 'qLKddrZdw9p5VPbAs2i/WXC7Goa5Mvy9KOpE3ZMwH1Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)