UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9aN8Zr/ty8RMKcv3u8dYZuElpcZQibGTSTfevTEiwZ4=' 
WHERE 
  key_id = '2b6c88fb73808b67305e36c2172486d67a8e936555055f3467442131e1eb5a7a' 
  AND (
    token = '9aN8Zr/ty8RMKcv3u8dYZuElpcZQibGTSTfevTEiwZ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037