UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Lvc94/S5AoGi8+7Uuv5YDaS+itICYrwGSBT/V5DO2nw=' 
WHERE 
  key_id = 'e5cdb93a2ffb318b581d14e54e7fa9d540ddde1c436b54bb0c7486b5475775de' 
  AND (
    token = 'Lvc94/S5AoGi8+7Uuv5YDaS+itICYrwGSBT/V5DO2nw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018