UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XSgxJRypEGh8DA5kCaJMSYNtUI/ylD4XY1ZLRhPBmzI='
WHERE
key_id = 'a0cb80c37ba356ccc19dd5e565edb5003df202a1303fb86f03160479cdb6823d'
AND (
token = 'XSgxJRypEGh8DA5kCaJMSYNtUI/ylD4XY1ZLRhPBmzI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)