UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UdtUk874HTg9LKU0oCyutrNX0rRIsLOET2fPS1w9r9A='
WHERE
key_id = 'c110d95fada6fb3389311237a904c48370a16f27ea91e735f9238492c0a118fe'
AND (
token = 'UdtUk874HTg9LKU0oCyutrNX0rRIsLOET2fPS1w9r9A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)