UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uiK19oDYt2390jHk6Qk5FatbiQwWYb3jZZQ8Tjh+2GI=' 
WHERE 
  key_id = 'c1d8e8b869b3f2784915922e992fa29ce41ae78f0ad6618c583eb22cfd986715' 
  AND (
    token = 'uiK19oDYt2390jHk6Qk5FatbiQwWYb3jZZQ8Tjh+2GI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023