UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p/XbQkYyXXf86QnzEc1vh7nsSsAfh5otl4WvjpDYRRs='
WHERE
key_id = '3bcddb578a792e46ff05af2b4224895b5c7f4dbfa65d83f1123121529def5ce8'
AND (
token = 'p/XbQkYyXXf86QnzEc1vh7nsSsAfh5otl4WvjpDYRRs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)