UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G5nIZ0vcpidmMgEMnSk3GCi6wXYs1gO2u6ziBh9Q1YI='
WHERE
key_id = '3739603e870c6549c9175b4b2565519ffd312b19a3392ceb57393014783277b6'
AND (
token = 'G5nIZ0vcpidmMgEMnSk3GCi6wXYs1gO2u6ziBh9Q1YI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)