UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dt8Htr4bUSc/Ol5izHOeGmqJizxQRaKY1C3PWL+X8EM=' 
WHERE 
  key_id = 'a1d028a9e186b260a10794da961323396a0c9a9d2618c324ca9409583279d8d9' 
  AND (
    token = 'dt8Htr4bUSc/Ol5izHOeGmqJizxQRaKY1C3PWL+X8EM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042