UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J091ChHWMukqMugv+1DOyo9/6ngJNEjvkkC34g4sIKU='
WHERE
key_id = '17baae9fa9ae8d1325db192ffdd0f0873fe1e36a528238b6302a8afbaef582ee'
AND (
token = 'J091ChHWMukqMugv+1DOyo9/6ngJNEjvkkC34g4sIKU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)