UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '02l1PCh0ulhV5P7CbopUQ/I8vKDEj/j8eNeVEIeUFoI='
WHERE
key_id = 'c1b47c1818345af77552cddc880b138ac90946fe679945df6c9e8464f5bff281'
AND (
token = '02l1PCh0ulhV5P7CbopUQ/I8vKDEj/j8eNeVEIeUFoI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)