UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mTLt9NESInmkzAFcCr8Z/aV9fUUa1/DvDABvU9AXs2w='
WHERE
key_id = 'c29629219fd15197f285a9301aece8489d4d1ac55380895b83167e3d898156d0'
AND (
token = 'mTLt9NESInmkzAFcCr8Z/aV9fUUa1/DvDABvU9AXs2w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)