UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AVFapRipgOk7NqOXCz5r5CHG+SBLKdDTRTH6aovQtPg=' 
WHERE 
  key_id = '3ff560461fe7c3b191a6117cab15791db467e634f3b8d28c4f9820599d20b9e8' 
  AND (
    token = 'AVFapRipgOk7NqOXCz5r5CHG+SBLKdDTRTH6aovQtPg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057