UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QX7vWCOU6OIEVg0K6hX+RXHHmY1zq8TzGLeXJqCWClk=' 
WHERE 
  key_id = '28aaa9b0aed7f110a4bf49735ea5d2e2df0742e0b4f0e070f56934aab53cb75c' 
  AND (
    token = 'QX7vWCOU6OIEVg0K6hX+RXHHmY1zq8TzGLeXJqCWClk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034