UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5YP8RerurpnFfwbBdX6Vl9OwQsz0iI5SNQPnUPcrD3M=' 
WHERE 
  key_id = '29af3569d91195f28db7b390fee51a335e109c74012f9a1250e102f126b2d230' 
  AND (
    token = '5YP8RerurpnFfwbBdX6Vl9OwQsz0iI5SNQPnUPcrD3M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057