UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6+koB81eZjTqxGiSeNjgZnSrnoBgOIBnO6N1NJLCU+Y='
WHERE
key_id = '38d83893f66f8ad1914c4acd869a6f811c074e2380867dee6a14aa0ea8cc8a17'
AND (
token = '6+koB81eZjTqxGiSeNjgZnSrnoBgOIBnO6N1NJLCU+Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)